using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Geekeradmin.Authorize;
using Publicuse.Autofac;

using Publicuse.Interface;
using Publicuse.Entity;
using Publicuse.Interface.Extend;

namespace Geekeradmin.Controllers.system
{
    /// <summary>
    /// 定时任务管理模块
    /// </summary>
    [UserAuthorize("Admin"), AllowAnonymous]
    public class ScheduledtaskController : BaseController
    {
        public ScheduledtaskController(IAutofaceInstance autoface, IMySqlSugarService mySqlSugar, 
            IWebHostEnvironment webHost, IOptions<DBConnectionOption> options, IBaseServiceExt baseServiceExt)
       : base(autoface, mySqlSugar, webHost, options, baseServiceExt)
        {
        }

        [HttpGet("Test")]
        public async Task<IActionResult> Test()
        {
            return await Task.Factory.StartNew(() =>
            {
                CommonResult result = new CommonResult() { code = (int)CodeResult.success, data = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") };
                return new JsonResult(result);
            });
        }
    }
}
